<!--
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-12-09 21:51:42
 * @LastEditors: GGB
 * @LastEditTime: 2021-12-11 08:44:33
-->
<template>
  <div>
    <button @click="show = !show">toggle</button>
    <transition name="fade">
      <p v-if="show">hello</p>
    </transition>
  </div>
</template>

<script>
import { emitter } from "../App.vue";
export default {
  data() {
    return {
      show: true,
    };
  },
  mounted() {
    emitter.on("sendMsg", data => {
      console.log(data);
    });
  },
};
</script>

<style scoped>
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
